/*
 * CharDataUnit.h
 *
 *  Created on: 21/04/2011
 *      Author: ehpalumbo
 */

#ifndef CHARDATAUNIT_H_
#define CHARDATAUNIT_H_

#include "DataUnit.h"
using namespace dataunits;

namespace chardataunits {


class CharDataUnit : public DataUnit {
protected:
	unsigned char data;
public:
	CharDataUnit(const unsigned char data);
	CharDataUnit(const CharDataUnit& other);
	virtual int asInt() const;
	virtual void writeOn(ostream& os);
	virtual bool operator==(const DataUnit& other);
	virtual bool operator<(const DataUnit& other);
	unsigned char asChar() const;
	virtual ~CharDataUnit();
};


class CharDataUnitFactory : public DataUnitFactory {
protected:
	vector<DataUnit*>* dataUnits;
public:
	CharDataUnitFactory();
	virtual vector<DataUnit*>& getAll();
	virtual DataUnit* createDataUnitFor(unsigned int value);
	virtual ~CharDataUnitFactory();
};


}

#endif /* CHARDATAUNIT_H_ */
